package cn.kgc.springcloud.feignclient;

import cn.kgc.springcloud.entity.CollectionDTO;
import cn.kgc.springcloud.entity.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Map;

/**
 * @author: mosin
 * @version: v1.0  2022/6/9
 * 商品客户端  通过服务名 在注册中心中获取通信的url
 */
@FeignClient("PRODUCTS")
public interface ProductClient {

    @RequestMapping("/product/product1")
    String test01();

    // 要通过@RequestParam注解 完成参数携带格式的设定 因为FeignClient 是一个伪http客户端
    @RequestMapping("/product/product2")
    String test02(@RequestParam("id") Integer id);

    //restful 风格传参  @PathVariable()
    @RequestMapping("/product/product3/{id}")
    String test03(@PathVariable("id") Integer id);

    //以json的格式进行数据传递
    @RequestMapping("/product/product4")
    String test04(@RequestBody Product product);


    @RequestMapping("/product/product5")
     String test05(@RequestParam("ids") String[] ids);


    @RequestMapping("/product/product6")
     String test06(@RequestBody  CollectionDTO collectionDTO);


    @RequestMapping("/product/product7")
    Product test07(@RequestParam("id") Integer id);

    @RequestMapping("/product/product8")
    ArrayList<Product> test08();

    @RequestMapping("/product/product9")
    String test09();

}
